//
//  StatusCellBottomView.swift
//  sinaWeiBo
//
//  Created by smartlei on 15/10/19.
//  Copyright © 2015年 smartlei. All rights reserved.
//

import UIKit

class StatusCellBottomView: UIView {

   override init(frame: CGRect) {
       super.init(frame: frame)
 
    
        setupUI()
    
    }
   required init?(coder aDecoder: NSCoder) {
       fatalError("init(coder:) has not been implemented")
   }
    //创建三个Button
    //转发
    //注意便利构造函数在使用的事后一定要指明变量类型，不然报错
    lazy var retweetedBtn: UIButton = UIButton(title: " 转发", fontSize: 13, titleColor: UIColor.lightGrayColor(), imgName: "timeline_icon_retweet")
    //评论
    lazy var commentBtn: UIButton = UIButton(title: " 评论", fontSize: 13, titleColor: UIColor.lightGrayColor(), imgName: "timeline_icon_comment")
    //点赞
    lazy var likeBtn: UIButton = UIButton(title: " 点赞", fontSize: 13, titleColor: UIColor.lightGrayColor(), imgName: "timeline_icon_like")
    
}
//MARK - 设置UI界面
extension StatusCellBottomView {
    
    //设置UI
    private func setupUI() {
        //创建分割线
        let sperateViewLeft: UIView = {
            
            let view = UIView()
            view.backgroundColor = UIColor.darkGrayColor()
            return view
        }()
        let sperateViewRight: UIView = {
            
            let view = UIView()
            view.backgroundColor = UIColor.darkGrayColor()
            return view
        }()
        
        //1 添加控件
        addSubview(retweetedBtn)
        addSubview(commentBtn)
        addSubview(likeBtn)
        addSubview(sperateViewLeft)
        addSubview(sperateViewRight)
        //2 设置约束
        retweetedBtn.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            
            make.left.equalTo(self.snp_left)
            
        }
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(retweetedBtn.snp_top)
            make.bottom.equalTo(retweetedBtn.snp_bottom)
            
            make.left.equalTo(retweetedBtn.snp_right)
            make.width.equalTo(retweetedBtn.snp_width)
            
        }
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(commentBtn.snp_top)
            make.bottom.equalTo(commentBtn.snp_bottom)
            
            make.left.equalTo(commentBtn.snp_right)
            make.right.equalTo(self.snp_right)
            
            make.width.equalTo(commentBtn.snp_width)
        }
        sperateViewLeft.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(retweetedBtn.snp_right)
            make.centerY.equalTo(retweetedBtn.snp_centerY)
            make.width.equalTo(0.5)
            make.height.equalTo(retweetedBtn.snp_height).multipliedBy(0.618)
            
        }
        sperateViewRight.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentBtn.snp_right)
            make.centerY.equalTo(commentBtn.snp_centerY)
            make.width.equalTo(0.5)
            make.height.equalTo(commentBtn.snp_height).multipliedBy(0.618)
            
        }
        
        
        backgroundColor =  UIColor(white: 0.8, alpha: 1.0)
    }
    
    
}
